﻿using System;

using BizElements.Web;
using BizElements.Web.UI;

namespace BizElements.Web.UI
{
    public partial class Toolbar : System.Web.UI.UserControl
    {
        /// <summary>Displays user data.</summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                DisplayUser();
            }
        }

        /// <summary>NOT IMPLEMENTED - add your sign-out implementation here.</summary>
        protected void uiLogoutBtn_Click(object sender, object e)
        {
            //AccountController.SignOut(/*in frameset*/ true);
        }

        /// <summary>Tries to dispaly user data.</summary>
        private void DisplayUser()
        {
            if (UserSession.Actor != null && UserSession.Actor.ExtendedProperties != null)
                this.uiCurrentUserLbl.Text = UserSession.Actor.ExtendedProperties["FullName"];
        }

        /// <summary>Target frame. Required only when using frames.</summary>
        public string TargetFrame { get; set; }
    }
}